package mathgame.filehandlerimpl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.Map.Entry;

public class TestFileReader {
	private ArrayList<String> al = new ArrayList<String>();
	
	/*public static void main(String[] args) {
		TestFileReader k = new TestFileReader();
		//k.testProblemReader();
		//k.sortMap();
	}
	
	/**public void testProblemReader(){
		ImplFileHandler i = new ImplFileHandler();
		Map<String, String> testMap = i.readProblem("problem/problem.txt");
		for(Entry<String, String> e : testMap.entrySet()){
			System.out.println(e.getKey());
			System.out.println(e.getValue());
		}
	}     **/
	
	public void sortMap(){
		ImplFileHandler i = new ImplFileHandler();
		Map<Integer, String> map = new HashMap<Integer, String>();
		map = i.readFile();
		Map<Integer, String> sortedMap	 = new TreeMap<Integer, String>(map);
		Set<Map.Entry<Integer, String>> s = sortedMap.entrySet();
		for(Map.Entry<Integer, String> e : s){
			String k = (e.getKey() +" "+ e.getValue());
			al.add(k);
		}
		int n = al.size();
		for(int k=n-1;k>-1;k--){
			System.out.println(al.get(k));	
		}				
	}
}
